package cn.wolfcode.luowowo.mgrsite.controller;

import cn.wolfcode.luowowo.article.query.DestinationQuery;
import cn.wolfcode.luowowo.article.query.RegionQuery;
import cn.wolfcode.luowowo.article.service.IDestinationService;
import cn.wolfcode.luowowo.article.service.IRegionService;
import com.alibaba.dubbo.config.annotation.Reference;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/destination")
public class DestinationController {

    @Reference
    private IDestinationService destinationService;

    @RequestMapping("/list")
    public String list(@ModelAttribute("qo") DestinationQuery qo, Model model){
        PageInfo pageInfo = destinationService.query(qo);
        model.addAttribute("pageInfo", pageInfo);

        model.addAttribute("toasts",destinationService.getToasts(qo.getParentId()));
        return "/destination/list";
    }
}
